/***********************************************************************
 * Module:  PDV.java
 * Author:  Igor Spremo, Milan Stojkov
 * Purpose: Defines the Class PDV
 ***********************************************************************/

package model.entity;

import java.io.Serializable;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;

/**
 * 
 * @author Igor Spremo, Milan Stojkov
 *
 */

@SuppressWarnings("serial")
public class PDV implements Serializable {
	
	protected Integer id;
	protected double visinaPDV;
	protected int verzija;

	protected Collection<NarucenaUsluga> naruceneUsluge;

	public Collection<NarucenaUsluga> getNaruceneUsluge() {
		if (naruceneUsluge == null)
			naruceneUsluge = new HashSet<NarucenaUsluga>();
		
		return naruceneUsluge;
	}

	public Iterator<NarucenaUsluga> getIteratorNaruceneUsluge() {
		if (naruceneUsluge == null)
			naruceneUsluge = new HashSet<NarucenaUsluga>();
		
		return naruceneUsluge.iterator();
	}

	public void setNaruceneUsluge(
			Collection<NarucenaUsluga> newNaruceneUsluge) {
		removeAllNaruceneUsluge();
		for (Iterator<NarucenaUsluga> iter = newNaruceneUsluge.iterator(); iter.hasNext();)
			addNarucenaUsluga((NarucenaUsluga) iter.next());
	}

	public void addNarucenaUsluga(NarucenaUsluga newNarucenaUsluga) {
		if (newNarucenaUsluga == null)
			return;
		if (this.naruceneUsluge == null)
			this.naruceneUsluge = new HashSet<NarucenaUsluga>();
		if (!this.naruceneUsluge.contains(newNarucenaUsluga))
			this.naruceneUsluge.add(newNarucenaUsluga);
	}

	public void removeNarucenaUsluga(NarucenaUsluga oldNarucenaUsluga) {
		if (oldNarucenaUsluga == null)
			return;
		if (this.naruceneUsluge != null)
			if (this.naruceneUsluge.contains(oldNarucenaUsluga))
				this.naruceneUsluge.remove(oldNarucenaUsluga);
	}

	public void removeAllNaruceneUsluge() {
		if (naruceneUsluge != null)
			naruceneUsluge.clear();
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public double getVisinaPDV() {
		return visinaPDV;
	}

	public void setVisinaPDV(double visinaPDV) {
		this.visinaPDV = visinaPDV;
	}

	public int getVerzija() {
		return verzija;
	}

	public void setVerzija(int verzija) {
		this.verzija = verzija;
	}

}